import 'package:flutter/material.dart';
import 'package:hbtrans_flutter/apis.dart';
import 'package:hbtrans_flutter/beans/orderlist_bean.dart';
import 'package:hbtrans_flutter/const.dart';
import 'package:hbtrans_flutter/utils/mydio.dart';
import 'package:shared_preferences/shared_preferences.dart';

class GoodOrderList extends StatefulWidget {

  @override
  _GoodOrderListState createState() => _GoodOrderListState();
}

class _GoodOrderListState extends State<GoodOrderList> {

  Widget itemList() {
    return Container(
        child: GestureDetector(
      onTap: () {},
      child: Row(
        children: <Widget>[
          Icon(
            Icons.photo,
            size: 75,
          ),
          SizedBox(
            width: 10,
          ),
          Expanded(
              child: Column(
            children: <Widget>[
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text(
                    '保定运通驾校-VIP班',
                    style: TextStyle(fontSize: 13, color: Color(0xff666666)),
                  ),
                  Text(
                    '¥299.0',
                    style: TextStyle(fontSize: 13, color: Color(0xff666666)),
                  )
                ],
              ),
              SizedBox(
                height: 3,
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text(
                    '标准',
                    style: TextStyle(fontSize: 13, color: Color(0xff666666)),
                  ),
                  Text(
                    'X1',
                    style: TextStyle(fontSize: 13, color: Color(0xff666666)),
                  )
                ],
              ),
              SizedBox(
                height: 3,
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  Container(
                    alignment: Alignment.center,
                    width: 80,
                    height: 21,
                    decoration: BoxDecoration(
                      color: Color(0xffF44336),
                      borderRadius: BorderRadius.circular(15.0),
                    ),
                    child: Text(
                      '七天无理由退换',
                      style: TextStyle(fontSize: 10, color: Colors.white),
                    ),
                  )
                ],
              )
            ],
          ))
        ],
      ),
    ));
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Card(
          margin: EdgeInsets.fromLTRB(15, 12, 15, 2),
          elevation: 0,
          color: Colors.white,
          child: GestureDetector(
            onTap: () {},
            child: Column(
              children: <Widget>[
                Padding(
                  padding: EdgeInsets.symmetric(horizontal: 15),
//                  child: Row(
//                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
//                    children: <Widget>[
//                      Row(
//                        children: <Widget>[
//                          Icon(
//                            Icons.photo,
//                            size: 32,
//                          ),
//                          SizedBox(
//                            width: 10,
//                          ),
//                          Text(
//                            '驾校名称',
//                            style: TextStyle(
//                                fontSize: 13, color: Color(0xff333333)),
//                          )
//                        ],
//                      ),
//                      Expanded(
//                          child: Text(
//                        '等待买家付款',
//                        style:
//                            TextStyle(fontSize: 11, color: Color(0xffF44336)),
//                      )),
//                    ],
//                  ),
                ),
                ListView.builder(
                  shrinkWrap: true,
                  itemCount: 2,
                  physics: NeverScrollableScrollPhysics(),
                  itemBuilder: (BuildContext context, int index) {
                    return itemList();
                  },
                ),
                Container(
                  alignment: Alignment.centerRight,
                  child: Text(
                    '共计1件商品，合计￥299.0',
                    style: TextStyle(fontSize: 13, color: Color(0xff333333)),
                  ),
                ),
                SizedBox(
                  height: 5,
                ),
//                Container(
//                  alignment: Alignment.centerRight,
//                  child:
//                  Container(
//                    alignment: Alignment.center,
//                    width: 50,
//                    height: 22,
//                    decoration: BoxDecoration(
//                      border: Border.all(
//                          color: Color(0xffF44336)),
//                      borderRadius: BorderRadius.circular(15.0),),
//                    child: Text('付款',style: TextStyle(fontSize: 11, color: Color(0xffF44336)),),
//                  ),
//                )
                Container(
                    alignment: Alignment.centerRight,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: <Widget>[
                        Container(
                          alignment: Alignment.center,
                          width: 60,
                          height: 23,
                          decoration: BoxDecoration(
                            border: Border.all(color: Color(0xff666666)),
                            borderRadius: BorderRadius.circular(15.0),
                          ),
                          child: Text(
                            '修改订单',
                            style: TextStyle(
                                fontSize: 11, color: Color(0xff666666)),
                          ),
                        ),
                        SizedBox(
                          width: 10,
                        ),
                        Container(
                          alignment: Alignment.center,
                          width: 50,
                          height: 22,
                          decoration: BoxDecoration(
                            border: Border.all(color: Color(0xffF44336)),
                            borderRadius: BorderRadius.circular(15.0),
                          ),
                          child: Text(
                            '付款',
                            style: TextStyle(
                                fontSize: 11, color: Color(0xffF44336)),
                          ),
                        ),
                      ],
                    ))
              ],
            ),
          ),
        ),
      ),
    );
  }
}
